from pymysql.converters import escape_string
import  pymysql
import time
# 连接mysql

db = pymysql.connect(host='rds637zp6c38m5952l72n.mysql.rds.aliyuncs.com', port=3306, user='ghsadmin', passwd='123QWEasd', db='test_ghsmall')
#db = pymysql.connect(host='12.18.0.18', port=3306, user='archery', passwd='ghstestarchery', db='archery')
# 获取mysql操作光标
sql_cursor = db.cursor()
start_time = time.time()
for i in range (1,100001):
    select_sql = '''
    update lwk_test set id2=%s where id1='1'
    ''' %(i)
    #print(select_sql)
    #select_sql_2 = 'select * from lwk_test'
    select_sql_3 = 'commit;'
    sql_cursor.execute(select_sql)
    sql_cursor.execute(select_sql_3)
    #sql_cursor.execute(select_sql_2)
    #res_info = sql_cursor.fetchall()
    #print(res_info)
end_time = time.time()
print("程序执行了%f秒"%(end_time - start_time))

#程序执行了1436.041626秒

#程序执行了243.589789秒
